import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'
import Layout from '../layout/index.vue'

const routes: Array<RouteRecordRaw> = [
    // 首页 
    {
        path: '/',
        name: 'layout',
        redirect: '/dashboard',
        component: Layout,
        children: [
            {
                path: '/dashboard',
                component: () => import("../layout/dashboard/Dashboard.vue"),
                name: 'Dashboard',
                meta: {
                    title: '首页'
                }
            }
        ]
    },

    // 基础数据 
    {
        path: '/basic',
        name: 'Basic',
        meta: {
            title: '基础数据'
        },
        component: Layout,
        children: [
            {
                path: '/basic/teacher',
                component: () => import("../layout/basic/Teacher.vue"),
                name: 'Teacher',
                meta: {
                    title: '讲师管理'
                },
            },
            {
                path: '/basic/student',
                component: () => import("../layout/basic/Student.vue"),
                name: 'Student',
                meta: {
                    title: '学员管理'
                },
            },
            {
                path: '/basic/course',
                component: () => import("../layout/basic/Course.vue"),
                name: 'Course',
                meta: {
                    title: '课程管理'
                },
            },
            {
                path: '/basic/room',
                component: () => import("../layout/basic/Room.vue"),
                name: 'Room',
                meta: {
                    title: '培训教室'
                },
            },
        ]
    },
]

const router = createRouter({
    history: createWebHistory(),
    routes
})


export default router